#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

size_t my_strlen(const char* arr)
{
	int count = 0;
	while(*arr != '\0')
	{
		arr ++;
		count++;
	}
	return count;
}
char* my_strcpy(char* str, const char* arr)
{
	char* ret = str;
	while (*str++ = *arr++)
	{
		;
	}
	return ret;
}
char* my_strcat(char* arr2, const char* arr1)
{
	char* ret = arr2;
	while (*arr2)
	{
		arr2++;
	}
	while (*arr2++ = *arr1++)
	{
		;
	}
	return ret;
}
int my_strcmp(const char* s1, const char* s2)
{
	//assert(s1 && s2);
	while (*s1 == *s2)
	{
		if (*s1 == '\0')
		{
			return 0;
		}
		s1++;
		s2++;
	}
	if (*s1 > *s2)
	{
		return 1;
	}
	else
	{
		return -1;
	}
}
char* my_memmov(void* dest, const void* src, size_t count)
{
	void* ret = dest;
	if (dest < src)
	{
		while (count--)
		{
			*(char*)dest = *(char*)src;
			dest = (char*)dest + 1;
			src = (char*)src + 1;
		}
	}
	else
	{
		while (count--)
		{
			*((char*)dest + count) = *((char*)src + count);
		}
	}
	return ret;
}
int main()
{
	char arr[] = "123456789";
	int arr1[10] = {1,2,3,4,5,6,7,8,9,10};
	char arr2[20] = "hll";
	
	int i = 0;
	//printf("%d\n", my_strlen(arr));
	//printf("%s\n", my_strcpy(arr,arr1));
	//printf("%s\n", my_strcat(arr2, arr1));
	//printf("%d\n", my_strcmp(arr2, arr1));

	my_memmov(arr1+2, arr1 , 20);
	for (i = 0; i < 10; i++)
	{
		printf("%d ", arr1[i]);
	}
	return 0;
}